package com.ziyucoding.springboot.labs.lab10.seatdemo.tccscfeign.orderservice.feign;

import com.ziyucoding.springboot.labs.lab10.seatdemo.tccscfeign.orderservice.feign.dto.ProductFrozenStockDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 产品服务 Feign 端
 *
 * @author ziyucoding
 * @date 2022-11-04
 **/
@FeignClient(name = "tcc-product-service")
public interface ProductServiceFeignClient {

    @GetMapping("/product/get-stock")
    Map<String, Object> getStock(@RequestParam("productId") Long productId);

    @GetMapping("/product/get-frozen-stock")
    Map<String, Object> getFrozenStock(@RequestParam("productId") Long productId);

    @PostMapping("/product/frozen-stock")
    Map<String, Object> frozenStock(@RequestBody ProductFrozenStockDTO dto);

    @PostMapping("/product/clean-frozen-stock")
    Map<String, Object> cleanFrozenStock(@RequestBody ProductFrozenStockDTO dto);

    @PostMapping("/product/rollback-frozen-stock")
    Map<String, Object> rollbackFrozenStock(@RequestBody ProductFrozenStockDTO dto);

}
